package cn.pid21.client.model.datapid;

import cn.pid21.client.model.Creator;
import cn.pid21.client.model.cstr.CommonMetadata;
import cn.pid21.client.model.datapid.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import lombok.*;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;

@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Data
public class BaseMetadata implements CommonMetadata {
	/**
     * id
     */

    private String id;

    /**
     *  资源名称(中文)
     */
    @Size(max=128)
    @NotBlank(message = "resourceChineseName Is Not Empty")
    @JacksonXmlProperty(localName = "resource_chinese_name")
    private String resourceChineseName;

    /**
     * 资源名称（英文）
     */
    @Size(max=128)
    @JacksonXmlProperty(localName = "resource_name")
    private String resourceName;

 	 /**
     * 名称类型 
     */
    @JacksonXmlProperty(localName = "resource_name_type")
    private String resourceNameType;    

    /**
     * CSTR 标识符
     */
    @Size(max=128)
    @NotBlank(message = "identifier Is Not Empty")
    @JacksonXmlProperty(localName = "identifier")
    private String identifier;

    /**
     * 资源链接
     */
    @NotNull(message = "urls Is Not Empty")
    @JacksonXmlElementWrapper(localName = "urls")
    @JacksonXmlProperty(localName = "url")
    private List<String> urls;

    /**
     * 标识状态 0-草稿,1-可注册,2可发现
     */
    @NotNull(message = "identificationStatus Is Not Empty")
    @JacksonXmlProperty(localName = "identification_status")
    private int identificationStatus;

    /**
     * 资源描述（中文）  v1 : descriptionZh
     */
    @Size(max=1024)
    @NotBlank(message = "descriptionCN Is Not Empty")
    @JacksonXmlProperty(localName = "description_cn")
    private String descriptionCN;

    /**
     * 资源描述（英文） v1 : descriptionEn
     */
    @Size(max=1024)
    @JacksonXmlProperty(localName = "description_en")
    private String descriptionEN;

    /**
     * 资源类型
     */
    @NotBlank(message = "resourceType Is Not Empty")
    @JacksonXmlProperty(localName = "resource_type")
    private String resourceType;

    /**
     * 资源创建者
     */
    @Valid
    @NotNull
    @JacksonXmlElementWrapper(localName = "creators")
    @JacksonXmlProperty(localName = "creator")
    private List<Creator> creators;

     /**
     * 提交机构名称
     */
    @Size(max=128)
    @NotBlank(message = "submitOrgName Is Not Empty")
    @JacksonXmlProperty(localName = "submit_org_name")
    private String submitOrgName;

    /**
     * 提交机构通信地址
     */
    @Size(max=128)
    @JacksonXmlProperty(localName = "submit_org_address")
    private String submitOrgAddress;

    /**
     * 提交机构邮政编码
     */
    @Size(max=6)
    @JacksonXmlProperty(localName = "submit_org_postcode")
    private String submitOrgPostcode;

    /**
     * 提交机构联系电话
     */
    @JacksonXmlProperty(localName = "submit_org_phone")
    private String submitOrgPhone;

    /**
     * 提交机构电子信箱
     */
    @JacksonXmlProperty(localName = "submit_org_email")
    private String submitOrgEmail;

 	/**
     * 资源发布机构(中文) v1:publisherZh
     */
    @Size(max=64)
    @NotBlank(message = "registerOrganizationCN Is Not Empty")
    @JacksonXmlProperty(localName = "register_organization_cn")
    private String registerOrganizationCN;

    /**
     * 资源发布机构(英文) v1:publisherEn
     */
    @Size(max=64)
    @JacksonXmlProperty(localName = "register_organization_en")
    private String registerOrganizationEN;
    /**
     * 发布时间
     */
    @NotNull(message = "publicationDate  Is Not Empty")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @JacksonXmlProperty(localName = "publication_date")
    private Date publicationDate;

    /**
     * 共享途径
     */
    @NotBlank(message = "shareChannel Is Not Empty")
    @JacksonXmlProperty(localName = "share_channel")
    private String shareChannel;

    /**
     * 共享范围
     */
    @NotBlank(message = "shareRange Is Not Empty")
    @JacksonXmlProperty(localName = "share_range")
    private String shareRange;

    /**
     * 申请流程
     */
    @JacksonXmlProperty
    private String process;

    /**
     * 贡献者
     */
    @JacksonXmlElementWrapper(localName = "contributors")
    @JacksonXmlProperty(localName = "contributor")
    private List<Contributor> contributors;

	/**
     * 替代标识符
     */
    @JacksonXmlElementWrapper(localName = "alternative_identifiers")
    @JacksonXmlProperty(localName = "alternative_identifier")
    private List<Identifier> alternativeIdentifiers;

    /**
     * 主题与分类
     */
    @JacksonXmlElementWrapper(localName = "subject_classifications")
    @JacksonXmlProperty(localName = "subject_classification")
    private List<Subject> subjectClassifications;
    /**
     * 关联标识符
     */
    @JacksonXmlElementWrapper(localName = "association_identifiers")
    @JacksonXmlProperty(localName = "relation")
    private List<Relation> associationIdentifiers;
    /**
     * 版权
     */
    @JacksonXmlElementWrapper(localName = "copyrights")
    @JacksonXmlProperty(localName = "copyright")
    private List<Copyright> copyrights;

    /**
     * 资助者
     */
    @JacksonXmlElementWrapper(localName = "funders")
    @JacksonXmlProperty(localName = "funder")
    private List<Funder> funders;

    /**
     * 科技资源引用标注建议
     */
    @JacksonXmlProperty(localName = "labeling_suggestions")
    private String labelingSuggestions;
    
}
